package com.pattern.singleton.hungry;

import org.junit.Test;

/**
 * Description
 *
 * @author hubiao
 * @since 2020-08-20 19:39
 */
public class HungrySingletonTest {

    @Test
    public void test01() {
        HungrySingleton hungrySingleton = HungrySingleton.getInstance();
        HungryStaticSingleton hungryStaticSingleton = HungryStaticSingleton.getInstance();
        System.out.println( hungrySingleton.toString() );
        System.out.println( hungryStaticSingleton.toString() );
//      结果：
//        com.pattern.singleton.hungry.HungrySingleton@69222c14
//        com.pattern.singleton.hungry.HungryStaticSingleton@606d8acf
    }

    @Test
    public void test02() {
        HungrySingleton hungrySingleton = HungrySingleton.getInstance();
        HungryStaticSingleton hungryStaticSingleton = HungryStaticSingleton.getInstance();
        System.out.println( hungrySingleton.toString() );
        System.out.println( hungryStaticSingleton.toString() );
//      结果：
//        com.pattern.singleton.hungry.HungrySingleton@69222c14
//        com.pattern.singleton.hungry.HungryStaticSingleton@606d8acf
    }
}
